#ifndef _DIALOG_H_
#define _DIALOG_H_

#include <string>
#include <SECore/Event.h>
#include <SEUi/Interactor/Interactor.h>
#include <SEUi/Widget/Widget.h>
#include <SECore/Signal.h>
#include <SEUi/ImGui/imgui.h>

namespace SEngine
{

    class Dialog : public Widget
    {
    public:
        enum class DialogType {
            Normal = 0,
            Modal = 1
        };
    public:
        Dialog();
        virtual ~Dialog() = default;

        void SetType(DialogType type) { m_type = type; }
        void Update(int delta) override;
        void Popup();

    private:
        DialogType m_type{DialogType::Normal};
    };

    class MessageDialog : public Dialog
    {
    public:
        MessageDialog() : Dialog() { this->SetType(DialogType::Modal); }
        virtual ~MessageDialog() = default;

        void Resize(float w, float h) { m_size.x = w; m_size.y = h; }

    public:
        Signal<int> SignalUpdate;

    protected:
        virtual void BeginUpdate() override { ImGui::SetNextWindowSizeConstraints(m_size, m_size); }
        virtual void UpdateImpl(int delta) override { SignalUpdate.Invoke(delta); }

    private:
        ImVec2 m_size{200.0f, 100.0f};
    };

} // namespace SEngine


#endif